<?php
namespace Admin\Controller;
use Admin\Controller\BaseController;

class AppController extends BaseController {
    public function _initialize(){
      $this->tbl='app';
       parent::_initialize();

    }
    public function index(){
      parent::showlist($this->tbl,'zhr_pid desc');
    }

    public function view(){
       $id=I('get.id');
    }

     public function form(){
      $this->assign('list',M('apptype')->select());
      parent::form($this->tbl);
    }
        
    // public function add(){
    //    parent::add($this->tbl,'admin.php/app/index','zhr_logo');
    //  }

     public function add(){
       $this->model=D('app');
       $data=I('post.');
       $data['zhr_logo']='';
       if(!empty($_FILES['zhr_logo'])){
         $data['zhr_logo']=uploadfile('zhr_logo',150);}
      $data['zhr_updatetime']=date();
       if ($this->model->create($data)) {
        $this->model->add();
        $this->success('创建成功',U('admin.php/app/index')); }
       else  $this->error($this->model->getError());
    }

    public function delete(){
      parent::delete($this->tbl,'admin.php/app/index');
    }

    public function mod(){
      $this->assign('list',M('apptype')->select());
      parent::mod($this->tbl);
    }   

     public function update(){
      parent::update($this->tbl,'admin.php/app/index');}

      public function search(){
       parent::search($this->tbl,'search_key');
    }
}
